package com.wangzh.collection.set;

import cn.hutool.core.lang.tree.Tree;


import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.TreeSet;

public class Demo {
    public static void main(String[] args) {
        System.out.println(Integer.valueOf('A'));

        TreeSet<Student> studentTree = new TreeSet<>(new Comparator<Student>() {
            @Override
            public int compare(Student o1, Student o2) {
                return o1.getAge()-o2.getAge();
            }
        });

        studentTree.add(new Student("zhangsan", 15));
        studentTree.add(new Student("wangwu", 17));
        studentTree.add(new Student("lishi", 16));

//        System.out.println(studentTree);

        List<Student> students = new ArrayList<>();
        students.add(new Student("zhangsan", 15));
        students.add(new Student("wangwu", 17));
        students.add(new Student("lishi", 16));
        students.add(new Student("lish", 19));
        students.sort(new Comparator<Student>() {
            @Override
            public int compare(Student o1, Student o2) {
                System.out.println(o2);
                System.out.println(o1);
                System.out.println("--");
                return o1.getAge()-o2.getAge();
            }
        });
        System.out.println(students);
    }
}
